using System;

public partial class BuffEntity : BuffModel
{
    static int instanceID = 0;
    public int ID;
    public bool IsDestroyed => Duration <= 0 || Stack < 0;
    public BuffEntity(BuffModel md)
    {
        ID = ++instanceID;
        GameUtil.FastAssignment(md, this);
    }

    public static BuffEntity Create(BuffModel md)
    {
        return new BuffEntity(md);
    }

    public static BuffEntity Create(int id)
    {
        return new BuffEntity(Global.BuffModelDic[id]);
    }

    public static void AddBuff(Robot robot, int id)
    {
        var buff = Create(id);
        robot.Entity.BuffList.Add(buff);
    }

    public void RoundStart()
    {
        if (Duration > 0)
        {
            Duration--;
        }
    }

}